package de.tabuma.soapforms.soapproject.view;

import de.tabuma.lib.tabumaview;
import de.tabuma.soapforms.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import de.tabuma.customer.entity.*;
/**
 *
 * @author alefen
 */
public class create extends  tabumaview {
    public create(String servlet, Hashtable parameter) {
        super(servlet, parameter);
    }

    @Override
    public void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out) {
        String next = "Next";
        String cancel = "Cancel";
        String projectUrl = "url";
        String projectMethode = "methode";
        String customer = "customer";
        String name = "name";
        String empty = "empty";

        out.println("<div class=\"contentBoxed\">");
        out.println("<div class=\"contentContent\">");

        List<Customer> cList = (List<Customer>) request.getAttribute(constants.customerList);

        out.println(this.getFormBeginn(null));
        out.println(this.getHiddenAsAttribute());
        out.println(printHiddenField(constants.addSoapProject1, "true"));

        out.println("<div class=\"cols\">");
        out.println(printForm1(name, constants.soapProjectName, request.getParameter(constants.soapProjectName)));
        
        out.println("\t<div class=\"col2\">");
        out.println("\t\t<div class=\"col2_head\">"+customer+"</div>");
        out.println("\t\t<div class=\"col2_content\">");
        out.println("\t\t\t<select name=\""+constants.customerId+"\">");
        for(int i=0;i<cList.size();i++) {
            Customer c = cList.get(i);
            out.println("\t\t\t\t<option value=\""+c.getId().intValue()+"\">"+c.getName()+"</option>");
        }
        out.println("\t\t\t</select>");
        out.println("\t\t</div>");
        out.println("\t</div>");
        out.println(printForm1(projectUrl, constants.soapProjectUrl, request.getParameter(constants.soapProjectUrl)));
        out.println("\t<div class=\"col2\">");
        out.println("\t\t<div class=\"col2_head\">"+projectMethode+"</div>");
        out.println("\t\t<div class=\"col2_content\"><select name=\""+constants.soapProjectMethod+"\"><option value=\"0\">"+empty+"</option></select></div>");
        out.println("\t</div>");
        out.println("</div>");

        out.println("<input type=\"submit\" class=\"button\" name=\""+constants.next+"\" value=\""+next+"\"/>");
        out.println("<input type=\"submit\" class=\"button\" name=\""+constants.cancel+"\" value=\""+cancel+"\"/>");
        out.println(this.getFormEnd());

        out.println("</div>");
        out.println("</div>");
        
    }
}